package com.ecs.to_tos_service.service.impl;

import com.ecs.to_tos_service.domain.GmsTrucknoInfo;
import com.ecs.to_tos_service.domain.GtsOuttruckHaulContainers;
import com.ecs.to_tos_service.domain.GtsOuttruckRecord;
import com.ecs.to_tos_service.mapper.ecs.GmsTrucknoInfoMapper;
import com.ecs.to_tos_service.mapper.tos.GtsOuttruckHaulContainersMapper;
import com.ecs.to_tos_service.mapper.tos.GtsOuttruckRecordMapper;
import com.ecs.to_tos_service.service.OracleTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class OracleTestServiceImpl implements OracleTestService {

    @Autowired
    GmsTrucknoInfoMapper gmsTrucknoInfoMapper;
    @Autowired
    GtsOuttruckHaulContainersMapper gtsOuttruckHaulContainersMapper;
    @Autowired
    GtsOuttruckRecordMapper gtsOuttruckRecordMapper;


    @Override
    public List<GmsTrucknoInfo> getListById(String id) {
//        GmsTrucknoInfo trucknoInfo = gmsTrucknoInfoMapper.selectByPrimaryKey(Long.parseLong(id));
        GmsTrucknoInfo trucknoInfo = gmsTrucknoInfoMapper.selectByannotations(Long.parseLong(id));

        List<GmsTrucknoInfo> gmsList = new ArrayList<>();
        gmsList.add(trucknoInfo);
        return gmsList;
    }

    @Override
    public List<GmsTrucknoInfo> getListByTruckNo(String gtiTruckNo) {

        List<GmsTrucknoInfo> gmsList =  gmsTrucknoInfoMapper.selectByChooseWhen(gtiTruckNo);

        return gmsList;
    }

    @Override
    public List<GtsOuttruckHaulContainers> getListByOhcId(Long ohcId) {
        List<GtsOuttruckHaulContainers> gmsList =  gtsOuttruckHaulContainersMapper.selectByResultMap(ohcId);

        return gmsList;
    }

    @Override
    public GtsOuttruckRecord getRecord(Long otrId) {


        return gtsOuttruckRecordMapper.selectByResultMap2(otrId);
    }
}
